const { rejects } = require("assert");
const { resolve } = require("path");

/*  封装一个mineReadFile函数  读取文件内容
    参数path
    返回promise对象
*/ 
function mineReadFile(path){
    return new Promise((resolve,reject)=>{
        require('fs').readFile(path,(err,data)=>{
            if(err){
                reject(err)
            }else{
                resolve(data)
            }
        })
    })
}
mineReadFile('./resource/content.txt').then(value=>{
    console.log(value.toString());
},reason=>{
    console.log(reason)
})